package com.community.backend.mapper;

import com.community.backend.annotation.AutoFill;
import com.community.backend.enumeration.OperationType;
import com.community.backend.pojo.PropertyFee;
import com.community.backend.pojo.vo.PropertyFeeQueryVO;
import com.community.backend.pojo.dto.PropertyFeeQueryDTO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;

@Mapper
public interface PropertyFeeMapper {
    Page<PropertyFeeQueryVO> pageQuery(PropertyFeeQueryDTO propertyFeeQueryDTO);
    @AutoFill(OperationType.INSERT)
    void insert(PropertyFee propertyFee);
    @AutoFill(OperationType.UPDATE)
    void update(PropertyFee propertyFee);

    @Select("select * from propertyfee where id = #{id} and isDelete = '未删除'")
    PropertyFee selectById(String id);
    @Update("update propertyfee set tradeNo = #{tradeNo},payment = #{payment},buyerId = #{buyerId},gmtPayment = #{gmtPayment},status = #{status},updateId = '支付宝',updateName='支付宝',updateRole='支付宝',updateTime =#{gmtPayment} where id = #{outTradeNo}")
    void updatePayment(String outTradeNo, String tradeNo, String payment, String buyerId, String gmtPayment, String status);
    @Update("update propertyfee set status = #{status},updateId = '支付宝',updateName='支付宝',updateRole='支付宝',updateTime =#{now} where id = #{outTradeNo}")
    void updateStatus(String outTradeNo, String status, LocalDateTime now);
    @AutoFill(value = OperationType.UPDATE)
    void updateById(PropertyFee propertyFee);
}
